package com.zq.common.exception.base;

import com.zq.common.enums.BusinessEnum;

/**
 * 业务异常
 */
public class BaseException extends RuntimeException {
    private static final long serialVersionUID = -4137688758944857209L;
    /**
     * http状态码
     */
    private String httpStatusCode;
    private String httpStatusMessage;

    /**
     * @param httpStatus http状态码
     */
    public BaseException(BusinessEnum httpStatus) {
        super(httpStatus.getResultMsg());
        this.httpStatusMessage = httpStatus.getResultMsg();
        this.httpStatusCode = httpStatus.getResultCode();
    }

    /**
     * @param code http状态码
     */
    public BaseException(String code, String msg) {
        super(msg);
        this.httpStatusCode = code;
        this.httpStatusMessage = msg;
    }

    public BaseException(String msg) {
        super(msg);
    }

    public String getHttpStatusCode() {
        return httpStatusCode;
    }

    public String getHttpStatusMessage() {
        return httpStatusMessage;
    }
}

